<?php
/*echo $_REQUEST['pro_id'];
echo $_REQUEST['project_name'];
echo $_REQUEST['project_manager'];
echo $_REQUEST['pro_description'];
echo $_REQUEST['start_date'];
echo $_REQUEST['complete_date'];
echo $_REQUEST['pro_status'];*/
include "../../operations/connection_ajax.php";
		
try {
	session_cache_expire(999999999);
	if(!isset($_SESSION)) 
{ 
session_start(); 
} 
	
	if (isset($_SESSION['addTester'])) {
		$tester = $_SESSION['addTester'];
		if ($_REQUEST['action']=='add') {	
			$existem = FALSE;
			foreach ($tester as $value) {
                	if ($value[1] == $_REQUEST['idemployee']) {
                		$existem = TRUE;
                	}
	        }		
	        if ($existem != TRUE) {
	        	array_push($tester,array('',$_REQUEST['idemployee'],$_REQUEST['username'],$_REQUEST['fullnames'],0,0,0));
				$_SESSION['addTester'] = $tester ;
	        		
			?>
	                <?php 
	                $indexT = 1;
	                foreach ($tester as $key => $value) {?>
	                
	                <tr>
	                	<td><input type="checkbox" onclick="ajaxTestCheck('<?=$key?>',this)" <?php if($value[6]==1){?> checked="checked" <?php }?> />&nbsp;
				                	<?=$indexT?><input type='hidden' value="<?=$value[1]?>" /></td>
	                	<td><?=$value[2]?></td>
	                	<td><?=$value[3]?></td>
	                	<td align="center"><span onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick='removeTester(this)'><img src='images/del.png'/></span></td>
                </tr>
                <?php $indexT +=1;}?>   
			
		<?php }}else if($_REQUEST['action']=='remove'){
			
				array_splice($tester , $_REQUEST['rowIndex'], 1);				
				$_SESSION['addTester'] = $tester ;
				
			?>
			
					<?php 
	                if (count($tester)<=0){
	                ?>
	                <tr>
	                	<td colspan="4"><?=$l_list_emplty?></td>
	                </tr>
	                <?php
	                }else{
	                $indexT = 1;
	                foreach ($tester as $key => $value) {?>
	                <tr>
	                	<td><input type="checkbox" onclick="ajaxTestCheck('<?=$key?>',this)" <?php if($value[6]==1){?> checked="checked" <?php }?> />&nbsp;
				                	<?=$indexT?><input type='hidden' value="<?=$value[1]?>" /></td>
	                	<td><?=$value[2]?></td>
	                	<td><?=$value[3]?></td>
	                	<td align="center"><span onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick='removeTester(this)'><img src='images/del.png'/></span></td>
                </tr>
                <?php $indexT +=1;}}?>   
				                
		<?php }
	}
	
} catch (Exception $e) {
	mysql_close($connection_ajax);
}

mysql_close($connection_ajax);
?>